#!/usr/bin/perl
#index.cgi

require './shutdown-lib.pl';

&header($text{'shutdown_title'}, "", "index", 0, 1);
#print("<hr>\n");
print "<form action=shutdown.cgi method=post onsubmit='disable_buttons();'>\n";
print "<input type=hidden name=shuttype value='r'>\n";
print "<table class=mode1 cellpadding=4>\n";
print "<tr> <td><input type=submit class=button1 name=restart value='$text{'restart'}' onclick=' return set_shutdown_type(this);'></td>\n";
print "<td>$text{'restart_hint'}</td></tr>\n";
print "<tr> <td><input type=submit class=button1 name=shutdown value='$text{'shutdown'}' onclick='return set_shutdown_type(this);'></td>\n";
print "<td>$text{'shutdown_hint'}</td></tr>\n";

print "</table></form>\n";
#print("<hr>\n");
print <<EOF;
<script>
function set_shutdown_type(obj)
{
	if (obj == document.forms[0].restart)
	{
		if (confirm("$text{'restart_query'}"))
		{
			document.forms[0].shuttype.value = "r";
			return true;
		}
	}
	else if (obj == document.forms[0].shutdown)
	{
		if (confirm("$text{'shutdown_query'}"))
		{
			document.forms[0].shuttype.value = "h";
			return true;
		}
	}
	return false;
}

function disable_buttons()
{
	document.forms[0].restart.disabled = true;
	document.forms[0].shutdown.disabled = true;
}
</script>
EOF

&footer("/", $text{'index'});
